using System;
using Sherwood.Security;
using Sherwood.Web;

namespace Sherwood.Content.SearchClient
{
    /// <summary>
    /// Provides a simple way of searching in the context of a user
    /// </summary>
    public class SignOnUserSearchClient : ClientSignedSearchClient
    {
        public Guid SessionId { get; set; }

        public SignOnUserSearchClient(string searchServiceUrl, string clientId, string privateKey, Guid sessionId) 
            : base(searchServiceUrl, clientId, privateKey)
        {
            SessionId = sessionId;
        }

        public override void PrepareSearchRequest(QueryParameterCollection queryParameters)
        {
            queryParameters.Add("session", SessionId);

            base.PrepareSearchRequest(queryParameters);
        }
    }
}